<!-- Create Corporate Office -->

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="layout" content="main" />
    <title>Create Corporate Office</title>
  </head>
  <body>
    <div class="nav">
      <span class="menuButton"><g:link class="list" action="listCorporateOffices">List Corporate Offices</g:link></span>
    </div>
    <div class="body">
      <h1>Create Company</h1>
      <g:if test="${flash.message}">
        <div class="message">${flash.message}</div>
      </g:if>
      <g:hasErrors bean="${company}">
        <div class="errors">
          <g:renderErrors bean="${company}" as="list" />
        </div>
      </g:hasErrors>
      <g:form action="save" method="post" >
        <div class="dialog">
          <table>
            <tbody>
              <tr class="prop">
                <td valign="top" class="name">
                  <label for="type">Type:</label>
                </td>
                <td valign="top" class="value ${hasErrors(bean:company,field:'type','errors')}">
                  <g:select optionKey="id" from="${CompanyType.list()}" name="type.id" value="${company?.type?.id}" ></g:select>
                </td>
              </tr>
              <tr class="prop">
                <td valign="top" class="name">
                  <label for="name">Name:</label>
                </td>
                <td valign="top" class="value ${hasErrors(bean:company,field:'name','errors')}">
                  <input type="text" id="name" name="name" value="${fieldValue(bean:company,field:'name')}"/>
                </td>
              </tr>
              <address:edit address="${company.primaryAddress}"/>
              <tr class="prop">
                <td valign="top" class="name">
                  <label for="primaryPhone">Phone:</label>
                </td>
                <td valign="top" class="value ${hasErrors(bean:company,field:'primaryPhone','errors')}">
                  <input type="text" id="primaryPhone" name="primaryPhone" value="${fieldValue(bean:company,field:'primaryPhone')}"/>
                </td>
              </tr>
              <tr class="prop">
                <td valign="top" class="name">
                  <label for="primaryEmail">Email:</label>
                </td>
                <td valign="top" class="value ${hasErrors(bean:company,field:'primaryEmail','errors')}">
                  <input type="text" id="primaryEmail" name="primaryEmail" value="${fieldValue(bean:company,field:'primaryEmail')}"/>
                </td>
              </tr>
              <tr class="prop">
                <td valign="top" class="name">
                  <label for="notes">Notes:</label>
                </td>
                <td valign="top" class="value ${hasErrors(bean:company,field:'notes','errors')}">
                  <textarea rows="5" cols="40" name="notes">${fieldValue(bean:company, field:'notes')}</textarea>
                </td>
              </tr>
              <tr class="prop">
                <td valign="top" class="name">
                  <label for="emailList">Email List:</label>
                </td>
                <td valign="top" class="value ${hasErrors(bean:company,field:'emailList','errors')}">
                  <g:checkBox name="emailList" value="${company?.emailList}" ></g:checkBox>
                </td>
              </tr>
              <tr class="prop">
                <td valign="top" class="name">
                  <label for="parentCompany">Parent Company:</label>
                </td>
                <td valign="top" class="value ${hasErrors(bean:company,field:'parentCompany','errors')}">
                  <input type="text" disabled="true" id="parentCompany" name="parentCompany" value="${fieldValue(bean:company,field:'parentCompany')}"/>
                </td>
              </tr>
            </tbody>
          </table>
        </div>
        <div class="buttons">
          <span class="button"><input class="save" type="submit" value="Create" /></span>
        </div>
      </g:form>
    </div>
  </body>
</html>
